﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace RaProWorld
{
    public class WorldmapObject
    {
        protected Texture2D img;
        public Vector2 pos;
        protected float scale;
        protected float scalePeriod;
        public bool isActive;
        public bool isSelected;
        public RaProGame theGame;
        public Score score;
        public String description;
        public String name;
        
        public WorldmapObject(Texture2D sprite, Vector2 position, RaProGame game, String description,Score newScore,String newName)
        {
            img = sprite;
            pos = position;
            scale = 1.0f;
            isSelected = false;
            isActive = true;
            theGame = game;
            score = newScore;
            this.description = description;
            name = newName;
        }

        public void Update()
        {
            if (isSelected)
            {
                scalePeriod += 0.1f;
                MathHelper.Clamp(scalePeriod, 0.0f, (float)(Math.PI * 2.0f));
                scale = 1.0f + (float)Math.Sin(scalePeriod) * 0.1f;
            }
            else
            {
                scale = 1.0f;
            }
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            Color overlay = (isActive ? Color.White : Color.Gray);

            spriteBatch.Draw(img, pos,
                null, overlay, 0.0f,
                new Vector2(img.Width / 2, img.Height / 2),
                scale,
                SpriteEffects.None, 0);
        }
    }
}